import 'package:flustars_flutter3/flustars_flutter3.dart';
import 'package:flutter/material.dart';
import 'package:ls_work/a_yyt/models/health_record_entity.dart';
import 'package:ls_work/util/ext_utils.dart';

class HealthRecordCell extends StatelessWidget {
  final HealthRecordInfo? info;
  HealthRecordCell({Key? key, this.info});
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.fromLTRB(15, 0, 15, 15),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        children: <Widget>[
          _cell(title1: '身高（cm）：', value1: info?.height, title2: '体重(kg)：', value2: info?.weight),
          _cell(title1: '低压（mmHg）：', value1: info?.low, title2: '高压（mmHg）：', value2: info?.high),
          _cell(title1: '血氧（%）：', value1: info?.oxygen, title2: '脉率（bpm）：', value2: info?.pulseRate),
          _cell(title1: '心率（bpm）：', value1: info?.heart, title2: '体温（℃）：', value2: info?.temperature),
          _cell(title1: '大便（次）：', value1: info?.bowelsNum, title2: '呼吸（次）：', value2: info?.breathe),
          _cell(title1: '血糖（早餐前）：', value1: info?.bloodSugarBeforeBreakfast, title2: '血糖（早餐后）：', value2: info?.bloodSugarLastBreakfast),
          _cell(title1: '血糖（午餐前）：', value1: info?.bloodSugarBeforeDinner, title2: '血糖（午餐后）：', value2: info?.bloodSugarLastDinner),
          _cell(title1: '血糖（晚餐前）：', value1: info?.bloodSugarBeforeLunch, title2: '血糖（晚餐后）：', value2: info?.bloodSugarLastLunch),
          _cell(title1: '血糖（睡前）：', value1: info?.bloodSugarBeforeSleep, title2: '血糖（其他）：', value2: info?.bloodSugarLastOther),

        ],
      ),
    );
  }

  Widget _cell({String? title1, num? value1, String? title2, num? value2}) {
    return Container(
      width: ScreenUtil.getInstance().screenWidth,
      padding: EdgeInsets.only(bottom: 15),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: <Widget>[
          Row(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[Text(title1??""), Text('${value1.toNumStr(placeHold: "-")}')],
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[Text(title2??""), Text('${value2.toNumStr(placeHold: "-")}')],
          )
        ],
      ),
    );
  }
}
